<?php
/**
 * Created by PhpStorm.
 * User: Frings
 * Date: 2016/9/5
 * Time: 16:06
 */
use yii\helpers\Url;

$web = Url::base();
?>



<?php
if ($goods != null && $goods != '') {
    for ($i = 0; $i < count($goods); $i++) {
        ?>
        <tr>
            <td>
                <input type="number" <?= $goods[$i]['sort'] == null ? 'disabled' : '' ?>
                       value="<?= $goods[$i]['sort'] == null ? 0 : $goods[$i]['sort'] ?>">
            </td>
            <td>
                <input onclick="checkSort(this)" type="checkbox"
                       name="goods" <?= $goods[$i]['sort'] != null ? 'checked="checked"' : '' ?>
                       value="<?= $goods[$i]['code'] ?>">
            </td>
            <td><?= $goods[$i]['code'] ?></td>
            <td><?= $goods[$i]['name'] ?></td>
            <td><?= $goods[$i]['selling_price'] ?></td>
        </tr>
        <?php
    }
}
?>

<script type="application/javascript">
    $(function () {
        //初始化checkbox样式
        $('.square-blue input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' // optional
        });
    });

    $('input:checkbox[name=goods]').on('ifClicked', function (event) {
//            $(this).is(':checked');
        checkSort(this);
    });
</script>
